home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 13
/
013.d81
/
flip 64
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
12KB
|
159 lines
5 dim a$(1),d(8),d2(8),s(1),a(8)
7 print"[147]vic flip-64"
8 print"formerly vic flip-iv"
9 print" by jim dubrouillet and sean smith"
10 print" modified for the c-64 by r. thibault"
15 print"instructions (y/n)?";
16 geta$:if a$="" then 16
17 if a$="n" then 21
18 if a$><"y" then 16
19 goto 2001
21 input"[147]name";a$:input"another";b$:x=1:z=1
22 if left$(b$,3)<>"com" then 25
23 a=val(right$(b$,1))-1:lf=-(a=0)*999-(a=1)*25-(a=3)*.63:co=1:goto 26
25 ifrnd(1)>.5thenc$=a$:a$=b$:b$=c$
26 printa$" white or black";:inputc$:ifc$="b"thenc$=b$:b$=a$:a$=c$:co=2*co
28 input"# across";n:input"up & down";o:a$(1)=a$:a$(0)=b$:v=15
29 n=2*int((int(-((n<11)and(n>2))*n-(n>10)*10-(n<4)*8))/2)
30 c$(0)="[144]":n1=2*int(int(-((o<11)and(o>2))*o-(o>10)*10-(o<4)*n)/2)
31 print"[147]":o=n-1:c$(1)=""
32 fora=0to8:readd(a):next:data-41,-40,-39,-1,0,1,39,40,41
33 s(0)=2:n3=n/2:n4=n3+1:n5=n1/2:n6=n5+1:n7=n3*n5:n8=n7
34 for u=1 to 4:if int(int(n7^(1/u))^u)=n7 then n8=int(n7^(1/u))
35 next:n7=n8:fora=1to2*n1step2
36 forb=1to2*nstep2:e=1064+40*a+b:pokee-41,207:pokee-40,208
37 poke e-1,204:poke e,250:next b,a:print"";
38 s(1)=2:s(0)=2:for a=55296 to 56295:poke a,5:next a
39 gosub 3000:rem sound
40 for a=1 to (n1-1)/2:print"";:next:print"[157][157]"
41 for a=1 to o/2:print"";:next
42 print"[207][208][144][207][208][157][157][157][157][204][186][144][204][186][157][157][157][157][207][208][157][157][204][186][204][186][145][157][157][207][208]":c=1
50 c=-(c=0)
51 print" "c$(c)a$(c)"[144]"s(0)""s(1):if w1=4 then 100
55 if co>0 and co-1=c then 300
60 goto 117
100 print"";a$;s(1)
101 print"";b$;s(0)
102 bc=1:bb=0:for xx=0 to 21:poke 53280,bc:poke 53281,bb:tt=bc:bc=bb:bb=tt
103 for yy=0 to 40:next yy:next xx
104 poke 53281,6:poke 53280,14:gosub 3000:rem end of game
105 print"play again?"
106 get c$:if c$><"y" and c$><"n" then 106
107 if c$="y" then restore:goto21
109 clr:print"[147]";:goto63010
117 qz=55334+2*x+80*(z-1):qw=qz-54272:r=peek(qz) and 7:gosub 140
118 pokeqz+1,c:pokeqz+40,c:pokeqz+41,c:pokeqw+1,127:pokeqw+40,127
119 pokeqw+41,127:poke qz,c
120 poke qw,127:p=peek(56320)
121 x=x-((p and 8)=0)+((p and 4)=0)
125 z=z-((pand2)=0)+((pand1)=0):gosub140:poke qz,r:poke qw,207:pokeqz+1,r
126 pokeqz+40,r:pokeqz+41,r:pokeqw+1,208:pokeqw+40,204:pokeqw+41,250
127 if (p and 16)><0 and c$><"f" then 117
130 goto 1000
140 get c$:ifc$="_"then63010
141 x=x+(c$="j")-(c$="k"):z=z+(c$="i")-(c$="m")
142 z=(z+(z>n1)-1)*-(z>0)+1:x=(x+(x>n)-1)*-(x>0)+1:return
200 b=peek(f-54272):if b><207 then fl=fl-d2(a):d2(a)=0:goto 1014
202 goto 1011
300 x=0:z=0:fm=0:sa=0:hv=-9:x2=0:z2=0:mf=0
302 sa=sa+1:x=x*-(x<n)+1:z=z-(x=1):qz=55334+2*x+80*(z-1):goto 1000
303 if fl>0 then 405
305 if mf=0 and sa=n1*n then w1=w1+1:goto 50
306 if sa<n1*n then 302
310 for a=0 to 8:d2(a)=a(a):next:x=x2:z=z2
311 fl=mf:e=55334+2*x+80*(z-1):goto 1020
405 ca=log(abs((x+(x>n3)*n3+(x<n4)*n4)*(z+(z>n5)*n5+(z<n6)*n6)))/log(n7)
406 cb=(ca<>int(ca)):vl=(cb-(cb=0))*ca+fl*ca*lf
407 xz=0:if vl>hv or (vl=hv and fl>mf) then xz=1
408 if xz=1 then hv=vl:x2=x:z2=z:for a=0 to 8:a(a)=d2(a):next:mf=fl
409 goto 305
1000 fl=0:e=qz:dx=135
1001 if (7 and peek(e))<2 then on 1-(co=c+1) goto 1016,303
1002 for a=0 to 8:if a=4 then next a
1005 d2(a)=0
1006 d2(a)=d2(a)+2
1007 fl=fl+2:f=e+d(a)*d2(a)
1008 if (7 and peek(f))>1 then fl=fl-d2(a):d2(a)=0:goto 1014
1009 goto 200
1010 if (7 and peek(f))>1 then fl=fl-d2(a):d2(a)=0:goto 1014
1011 if (7 and peek(f))=-(c=0) then 1006
1013 fl=fl-2
1014 next a
1015 if co-1=c then 303
1016 if fl<1 and w=3 then w=0:w1=w1+1:goto 50
1017 if fl<1 then w=w+1:c=-(c=0):goto 50
1020 w1=0:w=0:s(c)=s(c)+1+fl/2:s(-(c=0))=s(-(c=0))-fl/2:for a=0 to 8
1025 fory=0tod2(a)-2step2:f=e+d(a)*y:pokef,c:pokef+1,c:pokef+40,c
1026 pokef+41,c:dx=dx+1:next y,a
1027 if s(0)+s(1)=n*n1 then 100
1030 gosub 3000:goto 50
2001 rem instructions
2125 print"[147]the object of this game is to end"
2126 print" with more squares than your":print" opponent has."
2127 print"you are each a different color,"
2128 print" and start with two squares each."
2129 print"to make a legal flip,place the cursor"
2130 print" so that 1 or more of your"
2131 print" opponent's squares are between the"
2132 print" cursor and one of your squares."
2133 print"do you want to use a joystick (y or n)?"
2139 geta$:ifa$><"y"anda$><"n"then 2139
2140 if a$="n" then 2144
2141 print"[147]move the cursor with the joystick in"
2142 print"port 2 until it is in position for a legal flip,";
2143 print" then push the fire button.":goto 2155
2144 print"[147] "
2145 print" ^ "
2146 print" i "
2147 print" <j k> "
2148 print" m "
2149 print" v "
2150 print" "
2151 print"these keys will move the cursor in"
2152 print" the indicated direction."
2153 print"when the cursor is in position,":print" press f."
2155 print"if a legal flip, computer will flip"
2156 print"all the squares which are o.k."
2158 print"press any key to go on"
2159 get a$:if a$="" then 2159
2160 print"[147]possible board sizes are 4,6,8,& 10."
2161 print" you will input these later."
2163 print"if you do not input a size, the"
2164 print" computer will use 8 as the size."
2165 print" 4 is for very short games.":print" 6 is for short games."
2167 print" 8 is standard size."
2168 print" 10 is for long games."
2169 print"press any key to go on"
2172 get a$:if a$="" then 2172
2180 print"[147]to play the computer,type com1,com2,"
2190 print" com3,or com4 for 'another'."
2200 print"the higher the number the harder the":print" game."
2210 print"the game ends when no squares remain":print" green."
2220 print"the computer decides who chooses the":print" color."
2222 print"you may press '_' to exit the game"
2223 print" while playing."
2230 print"press any key to start game"
2240 get a$:if a$="" then 2240
2250 goto 21
3000 rem flip sound
3010 ss=54272
3020 poke ss+1,20
3030 poke ss+5,9
3040 poke ss+6,9
3050 poke ss+24,15
3060 poke ss+4,17
3070 for xy=1 to 40: next xy
3080 poke ss+4,16
3090 for xy=1 to 400:next xy
3100 for xy=15 to 0 step -1:for yy=0 to 20:next yy
3110 poke ss+24,xy:next xy:rem lower vol
3120 for xy=1 to 24:poke ss+xy,0:next xy:rem clear sound
3130 return
63000 rem connect back to l.s.
63002 print"[147]would you like to play again?"
63004 poke198,0:wait198,1:geta$:ifa$<>"y"anda$<>"n"thenpoke53280,rnd(1)*15:goto63004
63006 ifa$="y"then21
63008 :
63010 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
63020 poke631,13:poke632,13:poke198,2:end